#include "SelectionTool.h"
#include "AIS_Shape.hxx"
#include "TopoDS_Shape.hxx"

SelectionTool::SelectionTool(Handle(AIS_InteractiveContext) theContext) :
	myAisContext(theContext),
	myAisObject(NULL)
{
}

void SelectionTool::Initialize(TopAbs_ShapeEnum selectionMode, Handle(SelectMgr_Filter) filter)
{
	myAisContext->Deactivate();
	myAisContext->Activate(AIS_Shape::SelectionMode(selectionMode));
	myAisContext->AddFilter(filter);
}

void SelectionTool::Move(const Standard_Integer& x, const Standard_Integer& y, const Handle(V3d_View)& myView)
{
	myAisContext->MoveTo(x, y, myView, Standard_True);
}

void SelectionTool::Pick(const Standard_Integer& x, const Standard_Integer& y, const Handle(V3d_View)& myView)
{

}

Handle(SelectMgr_Filter) SelectionTool::GetFilter()
{
	SelectMgr_ListOfFilter filters = myAisContext->Filters();

	if (filters.Size() == 0)
		return NULL;

	return filters.Last();
}
